package com.yaodian100.ec.creditcard.service.impl;

import java.io.Serializable;
import java.util.List;

import org.hibernate.Hibernate;

import com.yaodian100.core.common.dao.impl.CommonCriteria;
import com.yaodian100.core.common.exception.CoreException;
import com.yaodian100.core.common.service.impl.DomainServiceImpl;
import com.yaodian100.ec.creditcard.entity.CreditcardDetail;
import com.yaodian100.ec.creditcard.service.CreditcardDetailService;

public class CreditcardDetailServiceImpl extends DomainServiceImpl<CreditcardDetail> implements CreditcardDetailService {

	@Override
	public void delete(CreditcardDetail entity) throws CoreException {
		entity.setDelete(true);
		getDao().update(entity);
	}

	@Override
	public List<CreditcardDetail> getList(int firstResult, int maxResults, CommonCriteria criteria, String[] sortOrder) throws CoreException {
		if( criteria == null )
			criteria = new CommonCriteria();
		criteria.addEq("delete", false);
		return super.getList(firstResult, maxResults, criteria, sortOrder);
	}

	@Override
	public Number getListSize(CommonCriteria criteria) throws CoreException {
		if( criteria == null )
			criteria = new CommonCriteria();
		criteria.addEq("delete", false);
		return super.getListSize(criteria);
	}

	@Override
	public List<CreditcardDetail> getAll(int firstResult, int maxResults, String[] sortOrder) throws CoreException {
		CommonCriteria criteria = new CommonCriteria();
		criteria.addEq("delete", false);
		return getList(0, -1, criteria, sortOrder);
	}

	@Override
	public Number getAllSize() throws CoreException {
		CommonCriteria criteria = new CommonCriteria();
		criteria.addEq("delete", false);
		return getListSize(criteria);
	}
	
}
